package com.turman.coroutionsample.net

import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object RetrofitClient {
    private val instance: Retrofit by lazy {
        Retrofit.Builder().client(
            OkHttpClient.Builder()
                .addInterceptor(HttpLoggingInterceptor().also { it.setLevel(HttpLoggingInterceptor.Level.BODY) })
                .build()
        ).baseUrl("https://api.github.com")
            .addConverterFactory(GsonConverterFactory.create()).build()
    }

    val githubservice: GithubApi by lazy {
        instance.create(GithubApi::class.java)
    }
}